#e
#Title[uGߕΕv]
#Text[]
#PlayLevel[eޗp]
#Image[.\img\.png]
#BackGround[Default]
#BGM[\bgm\Rin's Theme.mp3]
#ScriptVersion[2]

script_enemy_main {
	let imgEnemy = GetCurrentScriptDirectory ~ "img\s_rin.png";
	#include_function ".\lib\lib_common.txt"

	@Initialize {
		SetMovePosition02(GetCenterX, GetClipMinY + 90, 60);
		SetLife(600);
		SetTimer(65);
		SetDamageRate(20,20);
		SetScore(500000);
		CutIn(KOUMA, "uGߕΕv", "script\img\s_rin1.png", 129, 0, 256, 256);
		LoadGraphic(imgEnemy);
		SetTexture(imgEnemy);
		SetEnemyMarker(true);
		SetGraphicRect(1, 1, 34, 66);
		SetInvincibility(180);

		mainTask;
	}

	@MainLoop {
		SetCollisionA(GetX, GetY, 24);
		SetCollisionB(GetX, GetY, 24);
		yield;
	}

	@DrawLoop {
		SetColor(255,255,255);
		SetRenderState(ALPHA);
		SetTexture(imgEnemy);
		DrawGraphic(GetX, GetY);
	}

	@Finalize  {
		DeleteGraphic(imgEnemy);
	}

	task mainTask {
		loop(80) {yield;}

		loop
		{Concentration01(70);
		PlaySE(se_ch02);

		loop(70) {yield;}



			let angle= rand(0,360);

 			loop(24){CreateShotA("shot", GetX, GetY, 0);
			SetShotDataA("shot", 0, 3, angle, -3, 0, 3, RED21);

			let n= 1;
			while(n<25){
			let shot1= 1;
			let sangle= angle+(n+1)*5;
			CreateShotA(shot1, 0, 0, 0);
			SetShotDataA(shot1, 0, 0, sangle, 0, 0, 0, RED12);
			SetShotDataA(shot1, 150, 1, NULL, 0, 0, 1, RED12);

			SetShotKillTime("shot", 126);
			PlaySE(se_kira00);
		AddShot((n+1)*6, "shot", shot1, 0);
		n++ ;
		}
			angle+= 360/12;
			FireShot("shot");}
			loop(150) {yield;}

		SetMovePosition02(rand(GetCenterX -90, GetCenterX +90), rand(GetClipMinY +60,GetClipMinY +120), 90);

			loop(10) {yield;}

			PlaySE(se_tan01);
			loop(50){
					CreateShot01(rand(GetClipMinX-60, GetClipMinX-10), rand(GetClipMinY-150, GetClipMinY+250), rand(1, 3), rand(30, 60), YELLOW23, 0);
					loop(3){yield;}}
					loop(50){yield;}


		Concentration01(70);
		PlaySE(se_ch02);

		loop(70) {yield;}



			let angle= rand(0,360);

 			loop(24){CreateShotA("shot", GetX, GetY, 0);
			SetShotDataA("shot", 0, 3, angle, 3, 0, 3, BLUE21);

			let n= 1;
			while(n<25){
			let shot1= 1;
			let sangle= angle+(n+1)*5;
			CreateShotA(shot1, 0, 0, 0);
			SetShotDataA(shot1, 0, 0, sangle, 0, 0, 0, BLUE12);
			SetShotDataA(shot1, 150, 1, NULL, 0, 0, 1, BLUE12);

			SetShotKillTime("shot", 126);
			PlaySE(se_kira00);
		AddShot((n+1)*6, "shot", shot1, 0);
		n++ ;
		}
			angle+= 360/12;
			FireShot("shot");}
			loop(150) {yield;}

		SetMovePosition02(rand(GetCenterX -90, GetCenterX +90), rand(GetClipMinY +60, GetClipMinY +120), 90);

			loop(10) {yield;}

			PlaySE(se_tan01);
			loop(50){
					CreateShot01(rand(GetClipMaxX+10, GetClipMaxX+60), rand(GetClipMinY-150, GetClipMinY+250), rand(1, 3), rand(120,150), WHITE23, 0);
					loop(3){yield;}
					}
					loop(20){yield;}
					}
		}
	}
}
